﻿//-----------------------------------------------------------------------
// <copyright file="ICommunicationBusContract.cs" company="WpfDevelopment.com">
//     Copyright WpfDevelopment.com. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace WpfDevelopment.MVVM
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.Diagnostics.Contracts;

    /// <summary>
    /// Dummy class containing (code contract) contract for the ICommunicationBus interface
    /// </summary>
    [ContractClassFor(typeof(ICommunicationBus))]
    internal abstract class ICommunicationBusContract : ICommunicationBus
    {
        /// <summary>
        /// Notifies the specified message.
        /// </summary>
        /// <typeparam name="T">Type of message to send</typeparam>
        /// <param name="message">The message.</param>
        /// <param name="parameter">The parameter.</param>
        public void Notify<T>(T message, object parameter)
        {
            Contract.Requires<ArgumentNullException>(message != null, "message cannot be null");

            throw new NotImplementedException();
        }

        /// <summary>
        /// Registers the specified callback.
        /// </summary>
        /// <typeparam name="T">Type of message to register for</typeparam>
        /// <param name="message">The message.</param>
        /// <param name="callback">The callback.</param>
        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Justification = "code contracts")]
        public void Register<T>(T message, Action<object> callback)
        {
            Contract.Requires<ArgumentNullException>(message != null, "message cannot be null");
            Contract.Requires<ArgumentNullException>(callback != null, "callback cannot be null");
            Contract.Requires<ArgumentNullException>(callback.Target != null, "callback.Target cannot be null");

            throw new NotImplementedException();
        }
    }
}
